package cn.lzd.mr.count.partition;

import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Partitioner;

/**
 * 学习：先了解、后深入；先记录、后记忆；先理论、后实践；先模仿、后创新
 * Created by lzd on 2018/5/12.
 * key,value 对应mapper的输出
 *
 * 默认：HashPartitioner
 */
public class CustomPartition extends Partitioner<Text, IntWritable> {

    @Override
    public int getPartition(Text text, IntWritable intWritable, int i) {
//        String key = text.toString();
//        if (key.indexOf("公司") != -1) {
//            return 0;
//        } else if (key.indexOf("个人") != -1) {
//            return 1;
//        }
//        return 2;
        return 5;
    }
}
